﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AnyOffice.DAL;
using AnyOffice.Components;

namespace AnyOffice.Web.general.system.netshareGX
{
    public partial class diskshare_list : BasePage
    {
        public readonly DiskGXDao bll = new DiskGXDao();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Bind();
            }
        }

        /// <summary>
        /// 共享目录绑定
        /// </summary>
        public void Bind()
        {
            DiskTypeGXDao b = new DiskTypeGXDao();
            int tid = b.GetModel(base.Conn, Public_foldGX.DiskTypeName).DiskTypeID;
            rep_pfile.DataSource = bll.GetDiskMangerList(base.Conn, " ParentDiskID=0 and DiskTypeID=" + tid + " order by Seq asc");
            rep_pfile.DataBind();
        }

        protected void rep_pfile_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName == "edit")
            {
                string xx = e.CommandArgument.ToString();
                Response.Redirect("diskshare_form.aspx?DiskID=" + e.CommandArgument.ToString());
            }
            if (e.CommandName == "del")
            {
                bll.Delete(base.Conn, Convert.ToInt64(e.CommandArgument.ToString()));
                Bind();
            }
        }
    }
}